home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-28 | 5.6 KB | 163 lines | [TEXT/MPS ] |
- ;
- ; File: Translation.a
- ;
- ; Contains: Public Interface definitions to TranslationMgr.
- ;
- ; Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
- ;
-
- IF &TYPE('__INCLUDINGTRANSLATION__') = 'UNDEFINED' THEN
- __INCLUDINGTRANSLATION__ SET 1
-
-
- IF &TYPE('_TranslationDispatch') = 'UNDEFINED' THEN ; ••• to be removed
- _TranslationDispatch opword $ABFC ; ••• to be removed
- ENDIF ; ••• to be removed
-
-
- gestaltTranslationAttr EQU 'xlat' ; ••• move into GestaltEqu.a
- gestaltTranslationMgrExists EQU 0 ; ••• move into GestaltEqu.a
- gestaltTranslationMgrHintOrder EQU 1 ; True if hint order reversal fix in effect
-
- gestaltScrapMgrAttr EQU 'scra' ; ••• move into GestaltEqu.a
- gestaltScrapMgrTranslationAware EQU 0 ; ••• move into GestaltEqu.a
-
- ;gestaltStandardFileAttr EQU 'stdf'
- ;gestaltStandardFile58 EQU 0
- gestaltStandardFileTranslationAware EQU 1 ; ••• move into GestaltEqu.a
- gestaltStandardFileHasColorIcons EQU 2 ; ••• move into GestaltEqu.a
-
- ;gestaltEditionMgrAttr EQU 'edtn'
- ;gestaltEditionMgrPresent EQU 0
- gestaltEditionMgrTranslationAware EQU 1 ; ••• move into GestaltEqu.a
-
-
- ; error codes
- noTranslationPathErr EQU -3030 ; ••• move into Errors.a
- badTranslationSpecErr EQU -3031 ; ••• move into Errors.a
- noPrefAppErr EQU -3032 ; ••• move into Errors.a
-
-
- FileTranslationSpec RECORD 0
- data DS.L 12
- size EQU *
- ENDR
-
- ; DocOpenMethod = enumerated types on how a document can be opened
- domCannot EQU 0
- domNative EQU 1
- domTranslateFirst EQU 2
- domWildcard EQU 3
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;
- ; This routine returns a list of all FileTypes that an application can open by itself
- ;
- ; Enter: appVRefNumHint volume where application resides (can be wrong, and if is, will be used as a starting point)
- ; appSignature signature (creator) of application
- ; nativeTypes pointer to a buffer to be filled with up to 64 FileTypes
- ;
- ; Exit: nativeTypes zero terminated array of FileTypes that can be opened by app
- ;
- ; FUNCTION GetFileTypesThatAppCanNativelyOpen(appVRefNumHint : INTEGER;
- ; appSignature : OSType;
- ; VAR nativeTypes : TypesBlock) :OSErr;
- MACRO
- _GetFileTypesThatAppCanNativelyOpen
- MOVEQ #$1C,D0
- _TranslationDispatch
- ENDM
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;
- ; This routine makes a new list of file types that can be translated into a type in the given list
- ; Used by StandardFile
- ;
- ; Enter: originalTypeList pointer to list of file types that can be opened
- ; numberOriginalTypes number of file types in orgTypeList
- ; extendedTypeList pointer to a buffer to be filled with file types
- ; numberExtendedTypes max number of file types that can be put in extendedTypeList
- ;
- ; Exit: extendedTypeList buffer filled in with file types that can be translated
- ; numberExtendedTypes number of file types put in extendedTypeList
- ;
- ; FUNCTION ExtendFileTypeList( originalTypeList : SFTypeList;
- ; numberOriginalTypes : INTEGER;
- ; VAR extendedTypeList : SFTypeList;
- ; VAR numberExtendedTypes : INTEGER) : OSErr;
- ;
- MACRO
- _ExtendFileTypeList
- MOVEQ #$9,D0
- _TranslationDispatch
- ENDM
-
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;
- ; This routine checks if a file can be opened by a particular application.
- ; If so, it returns if it needs to be translated first, and if so then how.
- ; The FileTypes that the app can open are specified by nativelyOpenableTypes,
- ; or if it is NULL, GetFileTypesThatAppCanNativelyOpen is called.
- ;
- ; Enter: targetDocument document to check if it can be opened
- ; appVRefNumHint vRefNum of application to open doc ( can be wrong, and if is, will be used as a starting point)
- ; appSignature signature (creator) of application to open doc
- ; nativeTypes zero terminated list of FileTypes app can open natively, or NULL to use default list
- ; onlyNative whether to consider if document can be translated before opening
- ; howToOpen pointer to buffer in which to put how the document can be opened
- ; howToTranslate pointer to buffer in which to put a FileTranslationSpec record
- ;
- ; Exit: howToOpen whether file needs to be translated to be read
- ; howToTranslate if file can be translated, buffer filled in with how to translate
- ; returns noErr, noPrefAppErr
- ;
- ; FUNCTION CanDocBeOpened( targetDocument : FSSpec;
- ; appVRefNumHint : INTEGER;
- ; appSignature : OSType;
- ; nativeTypes : TypesBlockPtr;
- ; onlyNative : Boolean;
- ; VAR howToOpen : DocOpenMethod;
- ; VAR howToTranslate : FileTranslationSpec) : OSErr;
- ;
- MACRO
- _CanDocBeOpened
- MOVEQ #$1E,D0
- _TranslationDispatch
- ENDM
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;
- ; TranslateFile
- ;
- ; This routine reads a file of one format and writes it to another file in another format.
- ; The information on how to translated is generated by the routine CanDocBeOpened.
- ; TranslateFile calls through to the TranslateFile Extension's DoTranslateFile routine.
- ; The destination file must not exist. It is created by this routine.
- ;
- ; Enter: sourceDocument input file to translate
- ; destinationDocument output file of translation
- ; howToTranslate pointer to info on how to translate
- ; Exit: returns noErr, badTranslationSpecErr
- ;
- ; FUNCTION TranslateFile(sourceDocument : FSSpec;
- ; destinationDocument : FSSpec;
- ; howToTranslate : FileTranslationSpec) : OSErr;
- ;
- MACRO
- _TranslateFile
- MOVEQ #$0C,D0
- _TranslationDispatch
- ENDM
-
-
-
- ENDIF ; ...already included
-
-